package com.rapid.maintenance.ui.activity.productmall;

import android.view.View;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.RelativeLayout;
import android.widget.TextView;

import androidx.recyclerview.widget.RecyclerView;

import com.chad.library.adapter.base.BaseQuickAdapter;
import com.rapid.maintenance.R;
import com.rapid.maintenance.adapter.BusinessProductAdapter;
import com.rapid.maintenance.adapter.SimpleSliderAdapter;
import com.rapid.maintenance.base.BaseActivity;

import java.util.Random;

import butterknife.BindView;

public class ProductMallBusinessProductDisplayActivity extends BaseActivity {
    @BindView(R.id.iv_bg)
    ImageView ivBg;
    @BindView(R.id.shoucang)
    TextView shoucang;
    @BindView(R.id.tv_name)
    TextView tvName;
    @BindView(R.id.iv_logo)
    ImageView ivLogo;
    @BindView(R.id.ll_logo)
    LinearLayout llLogo;
    @BindView(R.id.header)
    RelativeLayout header;
    @BindView(R.id.choose)
    RecyclerView choose;
    @BindView(R.id.item)
    RecyclerView item;
    private SimpleSliderAdapter chooseAdapter;
    private BusinessProductAdapter productAdapter;

    @Override
    protected int provideRootLayout() {
        return R.layout.activity_product_mall_business_display;
    }

    @Override
    protected void init() {
        setTitle("产品展示");
        setStatusBarColor(0xFF016DB6);
        setToolBarColor(0xFF016DB6);

        choose.setAdapter(chooseAdapter = new SimpleSliderAdapter());
        chooseAdapter.addData("数控机床");
        chooseAdapter.addData("传动系统");
        chooseAdapter.addData("机床主体");
        chooseAdapter.addData("进口设备");
        chooseAdapter.addData("装配组件");
        chooseAdapter.addData("设备改造");
        chooseAdapter.addData("注 塑 机");
        chooseAdapter.setOnSelectCallBack(data -> {
            productAdapter.setNewData(null);
            int l = new Random().nextInt(20);
            for (int i = 0; i < l; i++) {
                productAdapter.addData(new Object());
            }
        });
        item.setAdapter(productAdapter = new BusinessProductAdapter());
        productAdapter.addData(new Object());
        productAdapter.addData(new Object());
        productAdapter.addData(new Object());
        productAdapter.addData(new Object());
        productAdapter.addData(new Object());
        productAdapter.addData(new Object());
        productAdapter.addData(new Object());
        productAdapter.addData(new Object());

        productAdapter.setOnItemClickListener(new BaseQuickAdapter.OnItemClickListener() {
            @Override
            public void onItemClick(BaseQuickAdapter adapter, View view, int position) {
                startActivity(ProductMallProductDetailActivity.class);
            }
        });
    }

}
